#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

char* my_strstr(const char* p1, const char* p2)
{
	const char* s;
	const char* end;
	end = p1;
	s = p2;
	while (*p1 != '\0')
	{
		if (*end == *p2)
		{
			p2++;
			end++;
		}
		else
		{
			p1++;
			end = p1;
			p2 = s;
		}
		if (*p2 == '\0')
		{
			return (char*)p1;
		}
	}
	return NULL;
}

int main()
{
	char a[10] = "abbbbcsd";
	char b[10] = "bbc";
	printf("%s \n", my_strstr(a, b));
	return 0;
}